Added MIME types, using array instead of switch. Amended formatting.