First rough implementation of sync