passing route into the funciton from the loop

Should fix issue #16