Fixed tests and removed dead code.