Trying out a new approach in which I run the entire function inside the creation of the menu. Currently stuck on extracting the title of selected text as a string.