Now checking directory in a function!