why were castles built in the medieval days and why arent they built any more?