identation and formatting correction

Also adds some comments in the code