At the end of the Middle Ages, castles began to lose their military function, but not their psychological impact as a symbol of authority. Gunpowder and cannons supported armies of mercenary troops, and the garrison forts built to house them adopted the crenellated walls of private aristocratic castles. By the sixteenth century, professional soldiers lived in barracks, a few officers and the governor had finer quarters, and kings and nobles merely directed the operations from distant palaces where battlements had become purely symbolic decoration. The Battle of Crecy between France and England in 1346 is traditionally considered to be the first use of cannons on the battlefield. At first the noise and smoke created by the explosion terrified horses and men, and wreaked more havoc than the projectiles. Early cannons could be more dangerous for the gunners than for the enemy, but military engineers rapidly developed the weaponsí power and accuracy. A castleís high walls and towers made easy targets for gunners whose power and accuracy reduced once formidable medieval buildings to rubble. Mining became more successful because the attackers could put explosives under the walls.