Integrate @jpmickinney's build_formats improvements

See #103 for original PR.