edited PWM control