More coffeescript to js.
Merged with master.