WIP: refactorings laying some groundwork for #12