Added rebuild data function