sad complicated code to count multiple runs