How the heart functions as a pump