added menus; changed loop behavior