new button to regenerate all files
new, simpler save_state() function