Major reconstruction using a LayoutFactory class to generate the template