Better composition type detection