Added proper spawning functionality