Samurai code is called the "way of the warrior". This means to be honest, fair and fearless in the face of death. This custom helps by being undoubted, this way people trusted the samurai. Without the trust in samurai people would get rid of the samurai.
Isolation affected japan by borrowing from other places in Asia. In 593, a female ruler, Empress Suiko came to power in japan. This custom helps the structure by getting stuff from Asia and they had to travel overseas for materials from other places.
Emperors was the first way they ruled in japan when government developed during the isolation period until the government changed. During japans later stages eventually using shoguns feudalism/social ranks and bureaucracy. Bureaucracy is a highly complex body of workers with many levels of authority. Shoguns were the military leaders during the era of the samurai. Government helped keep structure because it helped japan keep structure because it helped japan keep order and stability. They had law enforcement that taught everyone to respect and those laws without government there would have been no leaders, jobs, orders, laws or stability.