Refactor link command