A few bug fixes. Moves to coffeescript.