Fixed bugs in device discovery.

Also made it less verbose.