Modified flattener to work with tuples instead of dicts