Creates instantiation function