function to load from files