Added some comments

Cleaned up the code.