Modified nested object to have directory names as a key for faster searching