added jshint support and cleaned up some code