Write mergesort