many bug fixes and updates to tests, bump and publish to npm