Fix jshint complaints
Code reorganization to allow use as a simple library and enable unit tests; add tests and Travis config; dependency updates.