improved keyselection