Improved link detection