First rewrite

This seems to work nicely in a browser, but node (at least on the REPL) is not so much with the worky