finished gather_v implementation of greedy merge