Refactored Javascript files