improve menu logic