Updated algorithm

added event sync
Merge remote-tracking branch 'origin/master'