Minor fixes to prevent warnings - mostly about shadowing local variables...

Just a few minor fixes to prevent local variable shadowing warnings.