Made parallel_apply into a generic facility