Refactor the populateAddressVars function