Slight refactoring to make this its own standalone thing
Hook up some test coverage