Refactored device_controller.py and namespace_controller.py.