Fix jshint errors + code cleanup