added better syncing mechanism