added a function to calculate mileage stats