Added checking for folders