 The border in Međimurje and Baranya was defined as a border between the Kingdom of Hungary and the Kingdom of Serbs, Croats, and Slovenes, later renamed the Kingdom of Yugoslavia, pursuant to the Treaty of Trianon of 1920.The present outline of the border with Bosnia–Herzegovina and border with Montenegro is largely the result of the Ottoman conquest and subsequent recapture of territories in the Great Turkish War of 1667–1698 formally ending with the Treaty of Karlowitz, as well as the Fifth and Seventh Ottoman–Venetian Wars.This border had minor modifications in 1947 when all borders of the former Yugoslav constituent republics were defined by demarcation commissions implementing the AVNOJ decisions of 1943 and 1945 regarding the federal organisation of Yugoslavia.