Converted loading and saving data to be generic