Refine the directories.