replacing auto iterator with for loop for raspi compatibility (hopefully)