Changed to using QTextStream for input and output.