Moved spawning code to one place.