Don't use 'type' since it's the name of a builtin
Move template rendering into framework, and provide a way to set global context (as well as extend it in subclasses)