Lint: simplify logic, stop creating globals and JSHint suggested changes