Moving file processing to a separate method