PS-181: refactor deletion logic