restructure to use browserify. pull out ui code to its own file