Added Node.js support and some cosmetic fixes

Added closure and Node.js module exports support. Renamed constructor function to provide more relevant function name. Fixed semicolons. Added test for Node.js-like environment.