The variable name "type" is confusing. Can you please rename it to "type_instance"?