amend link tags and move them to top