Not only did Justinian restore some western territories to the Roman Empire, but he also codified Roman law (with his codification remaining in force in many areas of Europe until the 19th century) and built the largest and the most technically advanced edifice of the Early Middle Ages, the Hagia Sophia.