policy of castle destruction (known as slighting), rather than allow fortresses to be easily retaken and then held by the English, beginning with his own castles at Ayr and Dumfries, and including Roxburgh and Edinburgh. After the Wars of Independence, new castles began to be built, often on a grander scale as "livery and maintenance" castles, to house retained troops, like Tantallon, Lothian and Doune near Stirling, rebuilt for Robert Stewart, Duke of Albany in the fourteenth century. Early gunpowder weapons were introduced to Scotland by the 1330s. The new technology began to be installed in Scottish castles by the 1380s, beginning with Edinburgh. In the fifteenth century, gunpowder weaponry fundamentally altered the nature of castle architecture. Existing castles were adapted to allow the use of the new weapons by the incorporation of "keyhole" gun ports, platforms to mount guns and walls that were adapted to resist bombardment. Ravenscraig, Kirkcaldy, begun about 1460, is probably the first castle in the British Isles to be built as an artillery fort, incorporating "D-shape" bastions that would better resist cannon fire and on which artillery could be mounted. It also used "letter box" gun-ports, common in mainland Europe, although rarer in England, they rapidly spread across the kingdom. Scotland also led the way in adopting the new caponier design for castle ditches, as constructed at Craignethan Castle. Tower houses The largest number of late Medieval fortifications in Scotland built by nobles, about 800, were of the tower house design. Smaller versions of tower houses in southern Scotland were known as peel towers, or pele houses. The defences of tower houses were primarily aimed to provide protection against smaller raiding parties and were not intended to put up significant opposition to an organised military assault. This has led historian Stuart Reid to characterise them as "defensible rather than defensive". They were typically a tall, square, stone-built, crenelated building. They were often also surrounded by a barmkyn or bawn, a walled courtyard designed to hold valuable animals securely, but not necessarily intended for serious defence. They were built extensively on both sides of the border with England from the fourteenth century. James IV's (1488–1513) forfeiture of the Lordship of the Isles in 1494 led to an additional burst of tower building across the region. A number were also built in Scottish towns. An option for small landholders and farmers was the bastle house, a form