added the two versions of fold