Refactor to NPM module.

The attached changes update this module to be an npm package.