completed most of the prefix and length validation methods