improve combine function