handle more relay messages, use tree structure