This is a mergesort algorithem implementation