Fixed exporting the CommonJS module, and general whitespace fixes.

Hey there. 

This change includes a bunch of whitespace fixes, as well as a change to how the CommonJS module is exported. I'm not sure how long this has been broken for, but it now works as detailed in the README, and all the tests now pass.