More unit tests and cleanup.