organized code and added a few comments
Merge branch 'master' into gh-pages