adding sync code