added improved mergesort