Refactoring with related test tweaks