WIP: implement the save-state option