added updateAddrs, fixed main