Well the class structure was lords then samurais then farmers. How it stabilized society was it set a strict code to follow for each of the classes and they followed that. How it unified? I'm not so sure but my guess is that every person in each class fought for their power like the lords or for their land like the farmers.