changed max speed calculation