Move state delete code back into the pattern