refactoring js files