simplify code and add 64-bit-pair counter