Refactoring to be modular js files