refactor fold path