Improved directory identification