added PWM looping