Cleanup convert_manifest

These changes do not change change the functionality of `convert_manifest.py`. They only make the file a bit more readable. Any comments?

(There are still some issues (duplicate code) but I'll address that in another pr.)