Apparatus is described including a sensing electrode that detects electrical activity of a duodenum of a subject. The apparatus includes a control unit configured to facilitate a treatment of the subject responsively to the detected electrical activity. Other embodiments are also described.