Updated DeviceFactory to handle exceptions
Updated controller to use DeviceFactory