modified for multi file processing.