type for counter changed to not overflow before loop conditional is reached