implement sync function