Browserify refactor

Hefty refactor to make it oh so pretty.