Wrap templated functions in thread too