Cleanup up PWM code