Broke heartbeat code into mutliple chunks.