Cleaned up stale code, fixed unit tests.