Better error checking; MIME type safety