Fixed XML format being broken after last commit
Refactored MIME type handling