Refactored JS into objects to keep global scope clean, and fixed minor design annoyance.