Refactored the ReferLink() function, moved to a common utility class.