minor refactors to make more modular