Refactor link attribute rewrite
Refactor code and improve unit tests