 Complete the following phrase:  Joachim Gutkeled died while battling against the Babonići in April 1277. A month later, the general assembly declared Ladislaus IV to be of age, who was also authorized to restore internal peace with all possible means. These events ended the five-year chaotic conditions in the realm. The Kőszegis and the Babonići divided the Gutkeleds province between each other on the border of Transdanubia and Slavonia. Sometimes in the second half of the 1270s, Nicholas and Ivan handed over the familys landholdings in Varaždin County to their much younger brother Henry. In the course of the division of lands between the two elder brothers in 1279, Ivan was granted Kőszeg, Borostyánkő and Sárvár, while Szentvid and Léka present-day Lockenhaus, Austria went to Nicholas property. Since then, Ivan Kőszegi began to pursue an independent policy from Nicholas, which contributed to the establishment of an oligarchic province by the end of the 13th century. Simultaneously Ladislaus IV defeated his allies, the Geregyes, Ivan attempted to play off the late Stephen Vs first cousin, Andrew the Venetian, against Ladislaus. Upon his invitation, the duke came to Hungary for the first time in 1278. Andrew demanded Slavonia for himself, adopting the title of Duke of Slavonia, Dalmatia and Croatia and marched as far as Lake Balaton with Kőszegis troops. Duke Andrew also made Ivan as treasurer of his ducal court. In addition, Ivan Kőszegi was styled as ispán of Zala County too from 1278 to 1279. Andrew achieved nothing, however, and went back to Venice in autumn, because the Hungarian royal troops played a decisive role in Rudolfs victory over Ottokar II in the 