added mime-type guessing