Move matching logic out of service_reply_single function