Template tests, minor cleanup