Changed spawn function