Some visual quality changes made while reading through and learning what
is being done.
Simplified code and cleanup.
made several changes to make the code easier to read and follow.
Cleanup.