adding device selection code