Fix some issues with the export

- No need to export template functions
- Expose some template instantiations
Move definition of template instatiation to cpp
Don't export/import template functions