Passing atwix's selection procefure