more template code cleanups