move code from onConfigure to onInitialize