sol. for issue #2. allow directories as input