changed Template to an object instead of a library of static functions