improved device_token management