adding heartbeat functionality