Apparatus and methods are provided for use with a heart of a subject, including a set of one or more electrodes. A control unit paces the heart by driving a first electric current via the electrode set into tissue of the subject, in accordance with a first set of parameters. The control unit stimulates nitric oxide production by a portion of the heart by driving a second electric current via the electrode set into the portion of the heart, in accordance with a second set of parameters. Other embodiments are also described.