refactor render template and context
Merge branch 'refactor'