Code style and refactor based on JSHint settings