Moved mime type declaration
Added guard