Some improvements to PWM