Use const with range based loops.
Some other cleanup