Making it more robust for folders.