Added code for templates support and integral types.