revised saving and loading