An improved combine function.