Refactored render_link() method