Refactor the code that computes the acceleration.  Also fix a sign bug.