Make deleting nicer by merging the implementations for text and images