Changed to iterative merge, no more stack overflow