Refactor application JS files