extract menu and reorganize templates