turn keys structure to a dict, change name of rand_key (inst var of Key) to key