bib loop logic added