using template function overloading and typedef for clean code