add jshintrc
various optimiztions, refactors