Replaced OutputStream with Buffered FileWriter