Refactor: cleaner and more modular code
Merge branch 'master' into gh-pages