Reformat CoffeeScript and fix minor bug