#5 refactor as node module for browserify