added keyExists method