Added validation for text length in distance field