Fix variable shadowing warnings.

"instance" is being used both as the name of the global singleton variable and as a temporary pointer to the singleton object in functions that use it. This causes a shadowing warning.