Formatting and commenting

Cleaned up the formatting.
Added tons of comments