Refactored contexts in Template Packaging. refs #459