More details in the comments