Replaced forach loop with iterator in WaveHandler