wip: More factoring out repeat code