Extract addtional classes and functions which are getting unsightly large. Use some of the coding conventions more consistently.