Refactor global state out of template configuration to fix test suite