Added function to read directory trees