Rewrote spawn functions