Change structure of arrays and hashes