Copied code, but I guess to limit the number of folders created.