using to_class instead of to for handling subresources.