Implementation of a merge sort