js hint refactor