Updated get_directory_content function.