menu  function

add menu function, add error handling in menu