I wonder if you want to handle if speed is 0? It all depends on how you want this to blow up (or return infinite traveling time).