Made the Javascript file more maintainable.