Complete logic for multiple addresses and numbers