got the refactored code working a basic level with unit testing.  still needs further testing.