modified visual select function