refactor templates pass 2