Formatting and comments

Removed code that was not doing anything, as well as fixing formatting
and adding comments.