Change set_states() to set_states(KeyFile key_file)
Revert change to set_states() and imlemented the undo function
Undo - redo function complete