respawn function, still a bit wonky, but works in most simple usecases