optimize foldMap