Changed Pair class to templated class.