Improved / fixed respawn code and moved it into core.