conditional edit/delete