how heart functions?