remove some global variables and only call initialize() once