Refactoring js modules