Updated SpeedCommand.java with more efficient code