change all global variables to static