Generate travel times more cleanly using a function