improving multi-master sync.pl