added ids codes and savetxt
change constructor of save