Cleaning up code for "select from stack", also works on Ipad now.