Japan's modern written law is Western. However, this law operates in a society whose values are pre-Western. In order to understand the function of modern law, it is important to study older systems of law as well. The main phases of Japan's pre-modern legal development are: the indigenous customary law of the Yamato state; the import and adaptation of Chinese codes from the 7th century onwards; the use of Chinese legal techniques to bring order to the indigenous feudal law, culminating in the 13th century and leading to the independence of Japan's legal system from that of China; and the mature system of written law and custom of the Tokugawa state. It is owing to the existence of well-functioning channels of law that Japan was able to modernize rapidly.