refactoring js and adding 2 external files