Better code: use foldLeft rather than treeFold