DISCL-235: Code review Friday refactorings

This is preliminary draft review
if you erase it you should be resetting to to map.begin() as far as I know ?