added LoadState and SaveState