generalized; cleanup