Starting to port the main code to Coffeescript.