modified for single file input