Added initial mime-type check
Removed extra variable