Changed spawning algorithm.