JSHint fixes
small internal refactor