The Church played a dominant role in the Middle Ages, and the clergy stood at the top of the social order. Through its rites the Church presided over all the important events in people’s lives and determined their fate in the afterlife, in heaven or hell. Wealthy people gave land and treasure to the Church as thank offerings and in hopes of influencing their chances of salvation. With ample resources, bishops and abbots commanded the best talent and materials to build for the glory of God. Architecturally, church buildings led the way in the sophistication of their designs and building techniques and the splendor of their decoration. Every parish had its church and most noble families had their private chapels. Daily services and prayers, the celebration of the festivals of the Church, the invocation of saints in times of difficulty, the rituals of knighthood and the courts all meant that a castle needed a chapel, even when a parish church stood in a nearby village. The chapel might be a separate building located within the castle walls, but it might also be incorporated into the gatehouse or the great tower. A large castle might have both a private chapel for the family and a church for the parish.