CORE-4271: some refactoring to make upcoming changes easier