refactored to use browserify