How a pacemaker works