Refactor to allow unit testing using Jasmine and Karma and CI using Travis-ci.
Merge remote-tracking branch 'origin/master'