Added a metric ton of template tests; adjustments; docstrings.