complete rewrite as npm package