Cleaned up the code for the new version (convert dipatches to
handlers in other classes so as to divvy up the code to
smaller units orgainze the code into smaller, mofe functional units).