some unit testing.

It needs even more unit testing. Too little time :(