LPS-41603 Apply refactoring changes, thus preserving part of the original fix