Egghead refactoring js files