Organized Menu generation logic from xml