Make template more flexible, fix unicode printing