traverse function turned into a generator. The old nested list retained for the time being.