Better loop iteration in stepInTime() function