refact the code about link