Better use of coffeescript. Add start of tests.

Fixes issue #2.