Updated Code

Works as a module and has a npm counterpart