Moved the count right before its usage