Refactored against jslint