Minor change in the code

move function and add some comments