Make the userPref  line wrap the event listener adder (instead of the reverse as you have it), to minimise the number of listeners that get added.