implemented policies for menus
redesigned main loop