refactor for js lint