Added method and test for mergesorting