moved widget initialization into a separate method