Added comments and a little bit of code cleanup
Fixed indenting