Convert Stack to template