generalizing folds