Templates

Please see #761 for details.