Templates and nesting fixes

Seeing if this pull request still fails travis