Overly complicated version of length validation