Though the Presidency of Yugoslavia was the supreme commander of the armed forces and in command of Yugoslav People's Army, some task from presidency could be given through secretary of defense. Secretary of defense was officer with highest military rank that could command armed forces of Yugoslavia including Yugoslav People's Army and Territorial Defense. While President of Yugoslavia was in function he was, under the constitution, the supreme commander of armed forces that includes YPA and TO and he could also pass some of his duties as supreme commander to secretary of defense. They had the power to give highest military ranks, such as general or admiral, and to promote or relieve of duty the highest military officers. Secretary of defense was in charge of Yugoslav People's Army. Chief of Staff of Yugoslav People's Army in case that Secretary of defense was prevented or absent to fulfill his function was formally his deputy who could take command of armed forces. In 1987, under decree of Presidency of Yugoslavia, General Staff of YPA was renamed into General Staff of Armed forces of Yugoslavia thus giving effectively command of YPA and TO to one military body in order to effectively command with armed forces in case of war according to law of "All-peoples defense" from 1982.