Added calculation of acceleration.