refactor for delete message