major refactor towards browserify