clean up and add comments
Merge pull request #23 from hayd/comments

clean up and add comments