Misc. small refactors