Template cleanup/bug fix