add support for folding