Added device selection and minor changes