working version of "select"