Template fix
Partial rollback & refactoring