We can generalize further by only changing a few lines of code I believe: ```rust let max_duty = self.pwm.get_max_duty(); let duty_f = (f64::from(speed) / 100.0) * f64::from(max_duty); let duty = duty_f.round() as PWM::Duty; ```