How does the heart function as a pump?