restructure and template