A finally correct version of combine function.