Removing the harcoding of has.key()