Refactor link creation