replace it with a template function