Refactored and cleaned up code.  Modernized some constructs.