Modified it to be able to handle deeply-nested directories.