Added chrome compatibility and fixed compatibility issues with node.js

Hey Paul,

The library looks pretty good :+1: . If interested, feel free to accept the pull request. It adds compatibility for chrome and also fixed minor issues preventing it from working on node.js.

Tested on node 0.8.20 and chrome 27.

P.S. Just realised the pull request looks massive since I changed the directory structure a bit. Let me know if it would be easier to send a request without any directory modifications