Rewrote delta time computation to make the code a bit clearer.