saveToFile, ToString, refactoring