Added while loop to keep selecting until valid