helper methods and refactor.
merge sort version 1.