global variables changed to static