cleaned up content-type detection