Add preliminary template validation.
Missing: Proper error messages for why the template is invalid.

Fixes #6