changed mergesort class to template