Make the rest of template functions pluggable. Resolves #20