Refactoring in prep for variable sweep