added pwm code