refactor fold