Moved devices.py to its own module