     private func updateMeters() {
         UIGraphicsBeginImageContext(self.frame.size)
         
-        for var i=0; i < self.numberOfWaves; ++i {
-            
+        (0..<self.numberOfWaves).forEach { i in
             
             let wavelinePath = UIBezierPath()
             
             // Progress is a value between 1.0 and -0.5, determined by the current wave idx, which is used to alter the wave's amplitude.
             let progress = 1.0 - CGFloat(i)/CGFloat(self.numberOfWaves)
             let normedAmplitude = (1.5*progress-0.5)*self.amplitude
-            
-            
-            for var x = 0 as CGFloat; x<self.waveWidth + self.density; x += self.density {
-                
+
+            var x: CGFloat = 0
+            while x < self.waveWidth + self.density {
+
                 //Thanks to https://github.com/stefanceriu/SCSiriWaveformView
                 // We use a parable to scale the sinus wave, that has its peak in the middle of the view.
                 let scaling = -pow(x/self.waveMid-1, 2) + 1 // make center bigger

                else {
                    wavelinePath.addLineToPoint(CGPointMake(x, y))
                }
            }
            
            let waveline = self.waves.objectAtIndex(i) as! CAShapeLayer

                self.layer.addSublayer(waveline)
                self.waves.addObject(waveline)
            }
        }
    }

