Added condition to handle passing in a key that is not in the database