Refactor delete method