Implemented limit for distance calculation
Merged