added device selector pseudocode