Refactored Merge Sort