Modified directory processing code