General code cleanup
Merge branch 'master' into gh-pages