transforms hashes from one into another form following certain rules