Improve for duplicated directories