DISCL-235: Code review Friday refactorings

This is preliminary draft review
Yes, I had not done it because this code was never used...