The code above should use the new setRate function to avoid code duplication