implementing heartbeat functionality