removed inline function from inside the loop