Changed how the pwm parameters are set and added few general comments