added the option to save and restore images