Added functions for retrieving and restoring state