Generalized cleanup