better selection algo
more selection code