Fix failing tests; slight refactor per @stevendanna