added a unit test and cleaned up some other ones