Type detection