Tidy up deletion logic