Implemented function which write afs struct to file, remove unneded functions