Made it work when given a directory or directories.