Tested refactored code, fixed bugs.  Works.