Added detector distance auto detection.