Menu selection algorithm