Fix some small errors; add a couple of templates