writing combine function