Add some more tests, and fix a bug with deletion