counting retries + correct calculation of retry decisions + minor improvements