clean function and build a link