implement the basic logic of linking