saving modifications before stopping work
recursive function working and top_nodde sorting algorith for recursive function