added option to set onInitialized callback