Started some unit tests.

I started working on unit tests. This *isn't* ready to merge, but I want to use pull requests as a place to get comments and keep track of where this is.

@henn, I would like you to pay attention to this one as we go.