refactor InstanceGenerator