porting over the rest of the js to coffeescript. Still a couple of bugs left to iron out but almost there