WIP: rewriting module in pure js