Completed.  Heavily refactored.