By 1006, Stephen had consolidated his power, and started sweeping reforms to convert Hungary into a Western feudal state.
As a consequence, after the Mongols retreated, King Béla ordered the construction of hundreds of stone castles and fortifications, to defend against a possible second Mongol invasion.