more flexibility in alert handling and getting text of buttons

addresses #161