complete sync.py