small refactors in a large number of places