logic for obtainsKey