Changed the way to handle subdiagrams