Refactors linkAttributes to have less shared state