Refactored delete action