added check in modelling for maxdist value