initial unit tests, some cleanup