Refactored as npm package.