Begin refactoring to be more modular [ci skip]