Tests, improved domains, support for browserify

As per #2.

Also replaces #5.