corrected the map not repainting correctly and corrected the distance calculation of Model