Function templates

Remove the limitation of function templates, and it looks to work.