In the medieval period the wall circuit was expanded. What was the purpose of Castello a Mare?