implemeted load data function, almost done