Remove all global variables and balanceUpdate func