Fixed example
Added template function