added folding format function