Why the tests of length?  Shouldn't the file setting be enough?

If the length is needed we should use a symbolic constant.