Adapting code to the new get_resource_type helper function