Added logic to retrieve directory structure for menu