search and folding