modified to check for key does not conditions