Improves spawning code