included Exercise 3 again. Moved the lengthy and recurring computations of the force into a separate function.