Added some functions for controlling the PWM.