use flatten
non-polluting version