Average smoothing added.

Average smoothing rewritten and added to the code. Some other minor
tweeks have been added. The next step is to create a better data
structure for working with the data.