deep copy of data values, working flatten