adding loop count