Documentation.
Removed useless variables.
Comments. Factoring a variable.
Clean useless comments.
Remove magic numbers.
Changed output format. Added some user messages.
comments