separated parser code from Template class