memento of mergeSort. reimplemented