Pulled common functionality for the 'to element' problems into a base type.