added the dumpToFile method