Try decreasing the speed depending on how much speed is left so speed=speed-speed/(some number) the number you divide by might differ, depending on the material you drive on.