Adding type detection