adding some format and comments

to fully understand the code.