Changes to template and array replacement