added save and load functions for long term mem