refactor and simplify link