how does the heart work