factored out ends and coends