updating to use variables in layout
changing rendering to use single function