wholesale refactor