finished mergesort impl (untested)