initializeWidget refactor