Completed refactor for layout template