format the code

add some useful comments