updated lookup function for keys