code cleanup, and unit tests working again