add some comment to help understand the solution