refactor discard in deletion