Updated handle_devices to call factory with AMDevice objects