Code

fixes to some unit tests, and a cleanup