implemented the FoldCalculator