Apparatus is provided for application to a nerve (30) of a subject, including a housing (32), which is configured to be placed at least partially around the nerve (30) so as to define an inner surface (37) of the housing (32) that faces the nerve (30). A plurality of insulating elements (34) are coupled to the inner surface (37) of the housing (32) at respective insulating element longitudinal positions along the housing (32), such that the inner surface (37) of the housing (32) and pairs of the insulating elements (34) define one or more respective cavities (41) at respective cavity longitudinal positions along the housing (32). One or more electrodes (42) are fixed to the housing (32) in fewer than all of the cavities (41). Other embodiments are also described.