added Save State, based on tangr's mod