Fixed distance map test. Minor refactorings.