Apparatus and methods are described for use with (a) a muscle of a body of a subject and (b) an implanted functional device. An electrode is electrically coupled to the muscle. A compressible housing is compressed due to the movement of the muscle. An energy assembly includes a flywheel and an energy converter. The energy assembly (a) stores energy extracted from the movement of the muscle, by rotating the flywheel, (b) causes the muscle to undergo movement by driving a current into the muscle, via the electrode, using the stored energy, and (c) powers the implanted functional device using the stored energy. A chamber, in fluid communication with the housing, receives, from the compressible housing, fluid that is expelled from the compressible housing due to the compression of the compressible housing. Other applications are also described.