Add unknown-var condition
Move functions around
Add template file