Generalized cleanup.