Enhancement for intra-file duplicates and some minor const fixes.

Enhance to allow finding duplicate blocks within a file.
Also some minor const fixes to keep GCC compiler happpy.