folding, cleanup