Remove more dead code and add missing tests.