Fixed bugs in deletion. Added more tests