Fixed delete and fix after delete code, updated tests.
Increasing test coverage.