refactors merge_sort for greater readability.