refactoring js code