Updated to make it work and publish to npm