Updated explanation of the working solution