Refactored the entirety of the Coffeescript code into a new object-oriented, cleaner version