version updated
moved check inside loop