Refactored application JS.