Cleanup and Refactor Javascript Files