Modified lookupFile and lookupDirectory to handle nested entries.