Added total heartbeats code.