first commit for return. Here the code is reorganised in separated function, but the code to handle the behavior of the clicked Windows Popup make it messy. The code to handle behaviios give partial results. Need to refactore another way.