Skips directories. Improved condition for determining function.