Refactor instantiate using TypeValue

Good refactoring.