Updated code to use CommonJS modules and browserify.