Building hierarchy and tests