Fix import for model module for Python 2.7.
Initial clean up pass of the main script.
Second clean up pass of the main script.
Clean up of main script completed (for now).