validate_l function refactored.