Adding a visitor to validate templates.

close #14