Refactor and JSHint