refactoring links controller