first pattern for folding API