Refactoring with explicit instantiation