adding local and nonlocal device detection