Fix unnecessary loop() cycles