added dynamic mime type detection