working on generic mergesort