first draft of unit tests (haven't run them yet)