Implemented distance sync

Fix #122