Added WriteCounter to mergesort