improved, but sync not yet working