Made JS file more readable and easier to maintain.