CORE-3882: some refactoring and code cleanup