Used BufferedWriter instead of PrintWriter for increased performance.