refactored javascript into src directory