Mostly framed out based on http-browserify