`layoutTemplate` and `View` probably are better off as anonymous functions.  Drop the `var` and:

```js
function layoutTemplate(locals) {
  ...
}
```