added heartbeat functionality