Put 'delete' code in a function. Made it possible to delete both comments and messages.