corrected bug in while loop and added tag for when some counts < 5.