Added handling of missing keys and lookups