added mergeSort function, running into callstack exceeded errors