Reordered functions.
Also, wrote a "valid_formats" functions