lurch towards const correctness

No semantic changes - refactor only.