Script produces and writes out tidy data set.  Needs commenting and clean up.