retab JS
fix a few jshint errors: ===, blocks without brackets, function not at top of scope