Apparatus (4020) comprising a pancreaticobiliary secretion-diversion guide (4030) for use with secretions that enter a gastrointestinal tract at an anatomical entry location. Guide (4030) comprises first and second anchors (4252/4054) which apply pressure to the wall of the tract. A resilient connecting element (2037) is coupled to the anchors. A collection-facilitation tube (2080) is between the anchors and in contact with and around element (2037). Tube (2080) has an inner surface (2045) and an outer surface (2046), the inner surface defining a lumen for passage of food. The outer surface inhibits contact of the secretions with food and defines a space (7) between the outer surface and the tract. A diversion tube (2090) is in fluid communication with the space and passes secretions from the space distally. An intragastric anchor (4152) coupled to the guide maintains the guide in place. Other applications are also described.