flatten can be accomplished with foldl1