Added some stale topology detection code