Fixes tests and removes dead code.