More tests, and remove some dead code.