Begin refactoring out into more modular pieces