Add Average2Doubles from the book and clean up style