reorginize template structure