The pieces of code in the Solution section are very disconnected. Suggest merging some of the code to show the entire function at a given point.
JamesT