refactored js files