changed selection code