implemented load function