implemented respawn logic