Added logic to prevent max length < min length