A little more sophistacted type detection