New code with fixed tests.