updated PWM implementation