getKeyValues now returns a .map on the arr[key].
Added Try catch and a thrown error.