Prepare iteration counter in lib.
Use iteration counter in lib.