General cleanup

* Fixed a lot of jshint complaints
* Made callbacks more node.js compliant.