Cleanup and distance fix for Android