Second iteration, removed magic numbers and what not. Broke out a valid_length() func as well.