Address JSHint error messages. Refactor