In the late Middle Ages, Scottish armies were assembled on the basis of common service, feudal obligations and money contracts of "bonds" of "manrent". In 1513 these systems produced a large and formidable force, but in the mid-sixteenth century there were difficulties in recruitment. Individuals were expected to provide their own equipment, including axes and pole arms. Highland troops often brought bows and two-handed swords. Heavy armour was abandoned after the Flodden campaign. Highland lords tended to continue to use lighter chainmail and ordinary highlanders dressed in the plaid. The crown took an increasing role in the supply of equipment. The pike replaced the spear and the Scots began to convert from the bow to gunpowder firearms. Feudal heavy cavalry were replaced with light horse, often drawn from the Borders. James IV established a gun foundry in 1511 and gunpowder weaponry fundamentally altered the nature of castle architecture. In the 1540s and 1550s, Scotland was given a defended border of earthwork forts and additions to existing castles.