Add support for browserify

I did a little bit of code cleanup and added support for browserify, thought I'd check with you to see if you'd like to merge it in.