Implemented merge sort.