Added mergesort that merges blocks as soon as they are sorted