HeartBeat: Extracts the heartbeat code to a new class