Fixed some bugs. Added some comments.
Merge pull request #1 from theronrabe/master

Fixed some bugs. Added some comments.