Merge pull request #175 from evansb/refactor
Refactoring galore

(main@cd9f7865fbeed72386e7a6470cf5fe62ec5a87b8)