optimize instance building.