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