Fixed the delete, didn't work properly like this

I *really* should have done the test first, this was plain wrong. This one looks better and I added test cases for it. Sorry about!