Change a bunch of global variables to defines.