Add comments to explain the solution