Minor refactoring + jshint