refactored links_controller.rb