Revert "BZ-12444 removed mismerged code"

This reverts commit cbe3d836473c3aeac8d51ba696d7b8c05720858b.