Working write with new key structure