improved layout for templates, added generic layout in base