Adding keep/discard logic.