made -d parameter instead of -f. Added check to deal with string only filenames