more unit tests, more rearranging.