Improved device listing and added tests.
Attached tests (forgot to).