Like the other ancient Buddhist monasteries, Ajanta had a large emphasis on teaching, and was divided into several different caves for living, education and worship, under a central direction. Monks were probably assigned to specific caves for living. The layout reflects this organizational structure, with most of the caves only connected through the exterior. The 7th century travelling Chinese scholar Xuanzang informs us that Dinnaga, a celebrated Buddhist philosopher and controversialist, author of well known books on logic, lived at Ajanta in the 5th century. In its prime the settlement would have accommodated several hundred teachers and pupils. Many monks who had finished their first training may have returned to Ajanta during the monsoon season from an itinerant lifestyle.The caves are generally agreed to have been made in two distinct periods, separated by several centuries.