finished the code for distance or time!