Fixes and a couple of API improvements
Integration of new fixes/features, addition of test coverage, and refactoring to ES6 with minimal transpilation