moved a lot of the code to an object (utilizing coffeescript's OOP for kicks)