improve and fix menu logic