Optimised the template parser by eliminating the use of dynamic variables in the output function