Minor cleanup of global variables and void function