Refactored the MergeSort class.