Added cases to deal with tuples in output.