Apart from Japan's ability to adopt and adapt foreign culture, the Japanese feudal tradition imparted certain values that aided those who structured the modern Japanese state. In several respects, Japanese feudalism, which dates from the twelfth century, was unlike feudalism in Western Europe where liberal modernization eventually occurred. The notion of contract in Japan, as noted earlier, was less one of freemen who entered equally into an agreement but it did not follow the more authoritarian forms of feudalism in Prussia and traditional Russia. What is important here is that the Japanese were familiar with the idea that contract implied law, even if the partners were not always equal. The tradition of contract enabled the leaders of the Meiji Restoration to quickly write modern codes of law that so impressed Western nations that they surrendered the rights of extra-territoriality by the decade of the 1890s. Familiarity with the principal of contract also assisted the Japanese in establishing a modern judiciary and the framework for constitutional government. Perhaps more obviously, the tradition of feudalism that identified the warrior as the central ethical figure in society, naturally reinforced Japanese efforts to build a modern army and navy in the 1880s and made military careers attractive to able young men. And because of Japan's feudal code of honor, the Code of Bushido, the individual in Japan was accustomed to think in terms of duty and loyalty toward higher authorities and to engage in unlimited self-sacrifice for some entity or idea beyond the individual or his family. Finally, a strong national consciousness had grown up at an early date within Japanese feudalism. This national consciousness, combined with an equally strong sense of feudal loyalty, produced a genuine national patriotism long before the Tokugawa Shogunate was overthrown in 1867. For the Japanese, it was an easy step to shift loyalty from the Shogun to the Emperor and from the feudal realm to the nation as a whole.