Separated counter and threading logic