Ported to CoffeeScript, and other improvements