No, ok. 
Maybe  just add a comment to precise to call this function (preparePairs) only in the DOM section.