Changed calculation of max distance in domain to use the range #3503
Deleted whitespace #3503