Added template functions, dynamic default template. Fixes #001. Fixes #004.