ironed out and published to npm
tests runnable with npm test