wrting all device data when adding a new device instead of after every drag