Modified to sync with callback