A castle is a large building usually made out of stone. Castles were designed to be very defensive, so the people living inside would be safe from attack. They were usually built as homes for noble families or royal families. Castle design changed over the centuries to keep up with improvements in equipment designed for breaking into castles. After the invention of gunpowder and cannons, castles were no longer so effective against attacks. The building of new castles gradually stopped, and more recent castles are more decorative than defensive. The most recent castles are either replica castles or just very large mansions with some castle features added to them for decoration. The centremost tower in a castle is called a keep, the most secure part of the castle. The ditch around the castle which may or may not be filled with water is called a moat. The top edges of the castle walls are covered by battlements, which were used for archers to hide behind.