Refactor addSpawn method.