All tests pass now. Various fixes to code.