Layouting the template