Refactor browser JS to use browserify