moved most global variables to main