More refactoring and moving about to consolidate functionality.