Finished core of contacts sync mechanism (some refactor needed)