added get distance to TestMode encoder