saves state by sherh18 | SimScale