Fix mime types
Improve code