Changed to BufferedStreams for better performance