Cleanup for length-validation, added tests