refactored downlink handler when serial is used