Changed key_exists to array_key_exists