Added support for registering and instantiating generic types