addes pwm drive and minor fixes