Improved script to include backlinks