refactor, js var localization