Refactored js into 3 different files for MVC separation