adding device query code