Refactor spawner logic.