Type detection and output