rewrote selection search