Refactored to use functions for setting speeds.