Updates main routine.
Inserted Andi's formula for acceleration.