Detect type