Reimpliment in cofeescript.
Some different design choices were made
Merge