Remove unused local and static global variables

Remove unused local and static global variables. Variables have been identified by Understand (version 758) from Scitools.