rewrite of code, refactoring

clear data & save data tested
to test: remove all & restore all