Fixed module so it works in NodeJs. Also tidied up some jshint errors
Merge pull request #5 from grahamscott/nodejs-fix

Fixed module so it works in NodeJs. Also tidied up some jshint errors