migrated savetxt methods to io.h and io.cpp